package classificados.seguranca

import classificados.dominio.Pessoa;

/**
 * http://blog.springsource.com/2010/08/11/simplified-spring-security-with-grails/
 * 
 * @author Administrador
 *
 */
class Usuario {

	String username
	String password
	boolean enabled
	boolean accountExpired
	boolean accountLocked
	boolean passwordExpired
	
	Pessoa pessoa
	
	static constraints = {
		username blank: false, unique: true
		password blank: false
	}

	static mapping = {
		password column: '`password`'
	}

	Set<Papel> getAuthorities() {
		UsuarioPapel.findAllByUsuario(this).collect { it.papel } as Set
	}
	
	
}
